package main

import (
	"fmt"
	"os"
)

func main() {
	aPath, _ := os.Getwd()
	fileName := "/.gitignore"
	dstFile, err := os.Create(aPath + fileName)
	if err != nil {
		fmt.Println("创建出错", err.Error())
	} else {
		defer func(dstFile *os.File) {
			err := dstFile.Close()
			if err != nil {

			}
		}(dstFile)
		s := `# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
`
		_, err := dstFile.WriteString(s)
		if err != nil {
			return
		} else {
			fmt.Println("创建成功")
		}
	}
}
